package com.ryan.quartz.temp.strategy;

/**
 * @author Rayn on 2017/10/17.
 * @email liuwei412552703@163.com.
 */
public abstract class Duck {

    protected QuackBehavior quackBehavior;
    protected FlyBehavior flyBehavior;

    public Duck() {
    }

    public Duck(QuackBehavior quackBehavior, FlyBehavior flyBehavior) {
        this.quackBehavior = quackBehavior;
        this.flyBehavior = flyBehavior;
    }

    public void setFlyBehavior(FlyBehavior flyBehavior) {
        this.flyBehavior = flyBehavior;
    }

    public void setQuackBehavior(QuackBehavior quackBehavior) {
        this.quackBehavior = quackBehavior;
    }


    /**
     *
     */
    public void performQuack() {
        quackBehavior.quack();
    }


    /**
     * china
     */
    public void swin() {
        System.out.println("所有的鸭子不可能都会游泳");
    }


    /**
     *
     */
    public abstract void display();

    /**
     *
     */
    public void performFly() {
        flyBehavior.fly();
    }
}
